Termination w.r.t. Q of the following Term Rewriting System could not be shown:

Q restricted rewrite system:
The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.


QTRS
  ↳ DependencyPairsProof

Q restricted rewrite system:
The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.

Using Dependency Pairs [1,15] we result in the following initial DP problem:
Q DP problem:
The TRS P consists of the following rules:

MARK(tail(X)) → A__TAIL(mark(X))
A__FILTER(s(s(X)), cons(Y, Z)) → A__IF(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(cons(X1, X2)) → MARK(X1)
MARK(filter(X1, X2)) → A__FILTER(mark(X1), mark(X2))
A__PRIMESA__SIEVE(a__from(s(s(0))))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(head(X)) → A__HEAD(mark(X))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
A__IF(true, X, Y) → MARK(X)
MARK(filter(X1, X2)) → MARK(X1)
A__FROM(X) → MARK(X)
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
MARK(divides(X1, X2)) → MARK(X1)
A__IF(false, X, Y) → MARK(Y)
MARK(sieve(X)) → A__SIEVE(mark(X))
A__SIEVE(cons(X, Y)) → MARK(X)
MARK(if(X1, X2, X3)) → A__IF(mark(X1), X2, X3)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(sieve(X)) → MARK(X)

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.

↳ QTRS
  ↳ DependencyPairsProof
QDP
      ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(X)) → A__TAIL(mark(X))
A__FILTER(s(s(X)), cons(Y, Z)) → A__IF(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(cons(X1, X2)) → MARK(X1)
MARK(filter(X1, X2)) → A__FILTER(mark(X1), mark(X2))
A__PRIMESA__SIEVE(a__from(s(s(0))))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(head(X)) → A__HEAD(mark(X))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
A__IF(true, X, Y) → MARK(X)
MARK(filter(X1, X2)) → MARK(X1)
A__FROM(X) → MARK(X)
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
MARK(divides(X1, X2)) → MARK(X1)
A__IF(false, X, Y) → MARK(Y)
MARK(sieve(X)) → A__SIEVE(mark(X))
A__SIEVE(cons(X, Y)) → MARK(X)
MARK(if(X1, X2, X3)) → A__IF(mark(X1), X2, X3)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(sieve(X)) → MARK(X)

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 1 less node.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
QDP
          ↳ Narrowing

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(X)) → A__TAIL(mark(X))
MARK(filter(X1, X2)) → MARK(X2)
MARK(s(X)) → MARK(X)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(filter(X1, X2)) → A__FILTER(mark(X1), mark(X2))
MARK(cons(X1, X2)) → MARK(X1)
A__PRIMESA__SIEVE(a__from(s(s(0))))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(head(X)) → A__HEAD(mark(X))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
A__IF(true, X, Y) → MARK(X)
MARK(filter(X1, X2)) → MARK(X1)
A__FROM(X) → MARK(X)
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
MARK(divides(X1, X2)) → MARK(X1)
MARK(sieve(X)) → A__SIEVE(mark(X))
A__SIEVE(cons(X, Y)) → MARK(X)
MARK(if(X1, X2, X3)) → A__IF(mark(X1), X2, X3)
MARK(sieve(X)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By narrowing [15] the rule A__PRIMESA__SIEVE(a__from(s(s(0)))) at position [0] we obtained the following new rules:

A__PRIMESA__SIEVE(from(s(s(0))))
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
QDP
              ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(X)) → A__TAIL(mark(X))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(tail(X)) → MARK(X)
MARK(head(X)) → MARK(X)
MARK(cons(X1, X2)) → MARK(X1)
MARK(filter(X1, X2)) → A__FILTER(mark(X1), mark(X2))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(head(X)) → A__HEAD(mark(X))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(primes) → A__PRIMES
MARK(divides(X1, X2)) → MARK(X2)
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__SIEVE(from(s(s(0))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
MARK(divides(X1, X2)) → MARK(X1)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
MARK(sieve(X)) → A__SIEVE(mark(X))
MARK(if(X1, X2, X3)) → A__IF(mark(X1), X2, X3)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(sieve(X)) → MARK(X)

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 1 less node.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
QDP
                  ↳ Narrowing

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(X)) → A__TAIL(mark(X))
MARK(filter(X1, X2)) → MARK(X2)
MARK(s(X)) → MARK(X)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(filter(X1, X2)) → A__FILTER(mark(X1), mark(X2))
MARK(cons(X1, X2)) → MARK(X1)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(head(X)) → A__HEAD(mark(X))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(primes) → A__PRIMES
MARK(divides(X1, X2)) → MARK(X2)
A__IF(true, X, Y) → MARK(X)
MARK(filter(X1, X2)) → MARK(X1)
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
MARK(divides(X1, X2)) → MARK(X1)
A__SIEVE(cons(X, Y)) → MARK(X)
MARK(sieve(X)) → A__SIEVE(mark(X))
MARK(if(X1, X2, X3)) → A__IF(mark(X1), X2, X3)
MARK(sieve(X)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By narrowing [15] the rule MARK(sieve(X)) → A__SIEVE(mark(X)) at position [0] we obtained the following new rules:

MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(sieve(divides(x0, x1))) → A__SIEVE(divides(mark(x0), mark(x1)))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
MARK(sieve(0)) → A__SIEVE(0)
MARK(sieve(true)) → A__SIEVE(true)
MARK(sieve(s(x0))) → A__SIEVE(s(mark(x0)))
MARK(sieve(false)) → A__SIEVE(false)



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
QDP
                      ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(X)) → A__TAIL(mark(X))
MARK(sieve(divides(x0, x1))) → A__SIEVE(divides(mark(x0), mark(x1)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(tail(X)) → MARK(X)
MARK(head(X)) → MARK(X)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(cons(X1, X2)) → MARK(X1)
MARK(filter(X1, X2)) → A__FILTER(mark(X1), mark(X2))
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
MARK(head(X)) → A__HEAD(mark(X))
MARK(sieve(true)) → A__SIEVE(true)
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
A__PRIMESA__FROM(s(s(0)))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
MARK(divides(X1, X2)) → MARK(X1)
A__IF(false, X, Y) → MARK(Y)
MARK(sieve(0)) → A__SIEVE(0)
A__SIEVE(cons(X, Y)) → MARK(X)
MARK(if(X1, X2, X3)) → A__IF(mark(X1), X2, X3)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(sieve(X)) → MARK(X)
MARK(sieve(s(x0))) → A__SIEVE(s(mark(x0)))
MARK(sieve(false)) → A__SIEVE(false)

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 5 less nodes.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
QDP
                          ↳ Narrowing

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(X)) → A__TAIL(mark(X))
MARK(filter(X1, X2)) → MARK(X2)
MARK(s(X)) → MARK(X)
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(filter(X1, X2)) → A__FILTER(mark(X1), mark(X2))
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
MARK(head(X)) → A__HEAD(mark(X))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(primes) → A__PRIMES
MARK(divides(X1, X2)) → MARK(X2)
A__IF(true, X, Y) → MARK(X)
MARK(filter(X1, X2)) → MARK(X1)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
A__PRIMESA__FROM(s(s(0)))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
MARK(divides(X1, X2)) → MARK(X1)
A__SIEVE(cons(X, Y)) → MARK(X)
MARK(if(X1, X2, X3)) → A__IF(mark(X1), X2, X3)
MARK(sieve(X)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By narrowing [15] the rule MARK(head(X)) → A__HEAD(mark(X)) at position [0] we obtained the following new rules:

MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(head(filter(x0, x1))) → A__HEAD(a__filter(mark(x0), mark(x1)))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(head(divides(x0, x1))) → A__HEAD(divides(mark(x0), mark(x1)))
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(head(s(x0))) → A__HEAD(s(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(head(primes)) → A__HEAD(a__primes)
MARK(head(false)) → A__HEAD(false)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(head(0)) → A__HEAD(0)
MARK(head(true)) → A__HEAD(true)



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
QDP
                              ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(tail(X)) → A__TAIL(mark(X))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(tail(X)) → MARK(X)
MARK(head(X)) → MARK(X)
MARK(cons(X1, X2)) → MARK(X1)
MARK(filter(X1, X2)) → A__FILTER(mark(X1), mark(X2))
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(head(divides(x0, x1))) → A__HEAD(divides(mark(x0), mark(x1)))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(head(false)) → A__HEAD(false)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
MARK(head(true)) → A__HEAD(true)
MARK(from(X)) → MARK(X)
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(head(filter(x0, x1))) → A__HEAD(a__filter(mark(x0), mark(x1)))
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
A__FROM(X) → MARK(X)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(head(s(x0))) → A__HEAD(s(mark(x0)))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
A__HEAD(cons(X, Y)) → MARK(X)
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
A__TAIL(cons(X, Y)) → MARK(Y)
MARK(divides(X1, X2)) → MARK(X1)
A__IF(false, X, Y) → MARK(Y)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
A__SIEVE(cons(X, Y)) → MARK(X)
MARK(if(X1, X2, X3)) → A__IF(mark(X1), X2, X3)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(sieve(X)) → MARK(X)
MARK(head(0)) → A__HEAD(0)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 5 less nodes.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
QDP
                                  ↳ Narrowing

Q DP problem:
The TRS P consists of the following rules:

MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(tail(X)) → A__TAIL(mark(X))
MARK(filter(X1, X2)) → MARK(X2)
MARK(s(X)) → MARK(X)
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(tail(X)) → MARK(X)
MARK(head(X)) → MARK(X)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(filter(X1, X2)) → A__FILTER(mark(X1), mark(X2))
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
MARK(from(X)) → MARK(X)
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(head(filter(x0, x1))) → A__HEAD(a__filter(mark(x0), mark(x1)))
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(primes) → A__PRIMES
MARK(divides(X1, X2)) → MARK(X2)
A__IF(true, X, Y) → MARK(X)
MARK(filter(X1, X2)) → MARK(X1)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__FROM(X) → MARK(X)
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
A__PRIMESA__FROM(s(s(0)))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
A__HEAD(cons(X, Y)) → MARK(X)
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
MARK(divides(X1, X2)) → MARK(X1)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
A__SIEVE(cons(X, Y)) → MARK(X)
MARK(if(X1, X2, X3)) → A__IF(mark(X1), X2, X3)
MARK(sieve(X)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By narrowing [15] the rule MARK(tail(X)) → A__TAIL(mark(X)) at position [0] we obtained the following new rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(tail(s(x0))) → A__TAIL(s(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(tail(divides(x0, x1))) → A__TAIL(divides(mark(x0), mark(x1)))
MARK(tail(true)) → A__TAIL(true)
MARK(tail(false)) → A__TAIL(false)
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(tail(0)) → A__TAIL(0)
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(tail(filter(x0, x1))) → A__TAIL(a__filter(mark(x0), mark(x1)))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
QDP
                                      ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(tail(s(x0))) → A__TAIL(s(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(tail(X)) → MARK(X)
MARK(head(X)) → MARK(X)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(head(filter(x0, x1))) → A__HEAD(a__filter(mark(x0), mark(x1)))
MARK(tail(true)) → A__TAIL(true)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
MARK(tail(0)) → A__TAIL(0)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(filter(X1, X2)) → MARK(X2)
MARK(s(X)) → MARK(X)
MARK(tail(divides(x0, x1))) → A__TAIL(divides(mark(x0), mark(x1)))
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(filter(X1, X2)) → A__FILTER(mark(X1), mark(X2))
MARK(tail(false)) → A__TAIL(false)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(from(X)) → MARK(X)
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(primes) → A__PRIMES
MARK(divides(X1, X2)) → MARK(X2)
A__IF(true, X, Y) → MARK(X)
MARK(filter(X1, X2)) → MARK(X1)
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → A__IF(mark(X1), X2, X3)
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(sieve(X)) → MARK(X)
MARK(tail(filter(x0, x1))) → A__TAIL(a__filter(mark(x0), mark(x1)))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 5 less nodes.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
QDP
                                          ↳ Narrowing

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(head(filter(x0, x1))) → A__HEAD(a__filter(mark(x0), mark(x1)))
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(filter(X1, X2)) → A__FILTER(mark(X1), mark(X2))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → A__IF(mark(X1), X2, X3)
MARK(sieve(X)) → MARK(X)
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(tail(filter(x0, x1))) → A__TAIL(a__filter(mark(x0), mark(x1)))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By narrowing [15] the rule MARK(if(X1, X2, X3)) → A__IF(mark(X1), X2, X3) at position [0] we obtained the following new rules:

MARK(if(0, y1, y2)) → A__IF(0, y1, y2)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(if(primes, y1, y2)) → A__IF(a__primes, y1, y2)
MARK(if(cons(x0, x1), y1, y2)) → A__IF(cons(mark(x0), x1), y1, y2)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(if(sieve(x0), y1, y2)) → A__IF(a__sieve(mark(x0)), y1, y2)
MARK(if(s(x0), y1, y2)) → A__IF(s(mark(x0)), y1, y2)
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(if(divides(x0, x1), y1, y2)) → A__IF(divides(mark(x0), mark(x1)), y1, y2)
MARK(if(from(x0), y1, y2)) → A__IF(a__from(mark(x0)), y1, y2)
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(if(filter(x0, x1), y1, y2)) → A__IF(a__filter(mark(x0), mark(x1)), y1, y2)



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
                                        ↳ QDP
                                          ↳ Narrowing
QDP
                                              ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(tail(X)) → MARK(X)
MARK(head(X)) → MARK(X)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(head(filter(x0, x1))) → A__HEAD(a__filter(mark(x0), mark(x1)))
A__FROM(X) → MARK(X)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(if(filter(x0, x1), y1, y2)) → A__IF(a__filter(mark(x0), mark(x1)), y1, y2)
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(if(0, y1, y2)) → A__IF(0, y1, y2)
MARK(filter(X1, X2)) → MARK(X2)
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → A__FILTER(mark(X1), mark(X2))
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(if(s(x0), y1, y2)) → A__IF(s(mark(x0)), y1, y2)
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(from(X)) → MARK(X)
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(primes) → A__PRIMES
MARK(divides(X1, X2)) → MARK(X2)
MARK(if(primes, y1, y2)) → A__IF(a__primes, y1, y2)
A__IF(true, X, Y) → MARK(X)
MARK(filter(X1, X2)) → MARK(X1)
MARK(if(cons(x0, x1), y1, y2)) → A__IF(cons(mark(x0), x1), y1, y2)
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(if(sieve(x0), y1, y2)) → A__IF(a__sieve(mark(x0)), y1, y2)
MARK(divides(X1, X2)) → MARK(X1)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(if(divides(x0, x1), y1, y2)) → A__IF(divides(mark(x0), mark(x1)), y1, y2)
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(sieve(X)) → MARK(X)
MARK(if(from(x0), y1, y2)) → A__IF(a__from(mark(x0)), y1, y2)
MARK(tail(filter(x0, x1))) → A__TAIL(a__filter(mark(x0), mark(x1)))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 4 less nodes.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
                                        ↳ QDP
                                          ↳ Narrowing
                                            ↳ QDP
                                              ↳ DependencyGraphProof
QDP
                                                  ↳ Narrowing

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(head(filter(x0, x1))) → A__HEAD(a__filter(mark(x0), mark(x1)))
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(if(filter(x0, x1), y1, y2)) → A__IF(a__filter(mark(x0), mark(x1)), y1, y2)
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(filter(X1, X2)) → A__FILTER(mark(X1), mark(X2))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(if(primes, y1, y2)) → A__IF(a__primes, y1, y2)
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(if(sieve(x0), y1, y2)) → A__IF(a__sieve(mark(x0)), y1, y2)
MARK(divides(X1, X2)) → MARK(X1)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(sieve(X)) → MARK(X)
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(if(from(x0), y1, y2)) → A__IF(a__from(mark(x0)), y1, y2)
MARK(tail(filter(x0, x1))) → A__TAIL(a__filter(mark(x0), mark(x1)))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By narrowing [15] the rule MARK(filter(X1, X2)) → A__FILTER(mark(X1), mark(X2)) at position [0] we obtained the following new rules:

MARK(filter(primes, y1)) → A__FILTER(a__primes, mark(y1))
MARK(filter(sieve(x0), y1)) → A__FILTER(a__sieve(mark(x0)), mark(y1))
MARK(filter(cons(x0, x1), y1)) → A__FILTER(cons(mark(x0), x1), mark(y1))
MARK(filter(s(x0), y1)) → A__FILTER(s(mark(x0)), mark(y1))
MARK(filter(if(x0, x1, x2), y1)) → A__FILTER(a__if(mark(x0), x1, x2), mark(y1))
MARK(filter(false, y1)) → A__FILTER(false, mark(y1))
MARK(filter(true, y1)) → A__FILTER(true, mark(y1))
MARK(filter(0, y1)) → A__FILTER(0, mark(y1))
MARK(filter(from(x0), y1)) → A__FILTER(a__from(mark(x0)), mark(y1))
MARK(filter(divides(x0, x1), y1)) → A__FILTER(divides(mark(x0), mark(x1)), mark(y1))
MARK(filter(filter(x0, x1), y1)) → A__FILTER(a__filter(mark(x0), mark(x1)), mark(y1))
MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1))
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
                                        ↳ QDP
                                          ↳ Narrowing
                                            ↳ QDP
                                              ↳ DependencyGraphProof
                                                ↳ QDP
                                                  ↳ Narrowing
QDP
                                                      ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(filter(sieve(x0), y1)) → A__FILTER(a__sieve(mark(x0)), mark(y1))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(filter(true, y1)) → A__FILTER(true, mark(y1))
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(tail(X)) → MARK(X)
MARK(head(X)) → MARK(X)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(s(x0), y1)) → A__FILTER(s(mark(x0)), mark(y1))
MARK(head(filter(x0, x1))) → A__HEAD(a__filter(mark(x0), mark(x1)))
MARK(filter(if(x0, x1, x2), y1)) → A__FILTER(a__if(mark(x0), x1, x2), mark(y1))
MARK(filter(false, y1)) → A__FILTER(false, mark(y1))
A__FROM(X) → MARK(X)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(filter(filter(x0, x1), y1)) → A__FILTER(a__filter(mark(x0), mark(x1)), mark(y1))
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(if(filter(x0, x1), y1, y2)) → A__IF(a__filter(mark(x0), mark(x1)), y1, y2)
MARK(filter(primes, y1)) → A__FILTER(a__primes, mark(y1))
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(filter(X1, X2)) → MARK(X2)
MARK(s(X)) → MARK(X)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(filter(from(x0), y1)) → A__FILTER(a__from(mark(x0)), mark(y1))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1))
MARK(filter(cons(x0, x1), y1)) → A__FILTER(cons(mark(x0), x1), mark(y1))
MARK(from(X)) → MARK(X)
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(primes) → A__PRIMES
MARK(divides(X1, X2)) → MARK(X2)
MARK(if(primes, y1, y2)) → A__IF(a__primes, y1, y2)
A__IF(true, X, Y) → MARK(X)
MARK(filter(X1, X2)) → MARK(X1)
MARK(filter(0, y1)) → A__FILTER(0, mark(y1))
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(if(sieve(x0), y1, y2)) → A__IF(a__sieve(mark(x0)), y1, y2)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(filter(divides(x0, x1), y1)) → A__FILTER(divides(mark(x0), mark(x1)), mark(y1))
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(sieve(X)) → MARK(X)
MARK(tail(filter(x0, x1))) → A__TAIL(a__filter(mark(x0), mark(x1)))
MARK(if(from(x0), y1, y2)) → A__IF(a__from(mark(x0)), y1, y2)
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 5 less nodes.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
                                        ↳ QDP
                                          ↳ Narrowing
                                            ↳ QDP
                                              ↳ DependencyGraphProof
                                                ↳ QDP
                                                  ↳ Narrowing
                                                    ↳ QDP
                                                      ↳ DependencyGraphProof
QDP
                                                          ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(filter(sieve(x0), y1)) → A__FILTER(a__sieve(mark(x0)), mark(y1))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(s(x0), y1)) → A__FILTER(s(mark(x0)), mark(y1))
MARK(head(filter(x0, x1))) → A__HEAD(a__filter(mark(x0), mark(x1)))
MARK(filter(if(x0, x1, x2), y1)) → A__FILTER(a__if(mark(x0), x1, x2), mark(y1))
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(filter(filter(x0, x1), y1)) → A__FILTER(a__filter(mark(x0), mark(x1)), mark(y1))
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(if(filter(x0, x1), y1, y2)) → A__IF(a__filter(mark(x0), mark(x1)), y1, y2)
MARK(filter(primes, y1)) → A__FILTER(a__primes, mark(y1))
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(filter(from(x0), y1)) → A__FILTER(a__from(mark(x0)), mark(y1))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(if(primes, y1, y2)) → A__IF(a__primes, y1, y2)
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(if(sieve(x0), y1, y2)) → A__IF(a__sieve(mark(x0)), y1, y2)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(sieve(X)) → MARK(X)
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(if(from(x0), y1, y2)) → A__IF(a__from(mark(x0)), y1, y2)
MARK(tail(filter(x0, x1))) → A__TAIL(a__filter(mark(x0), mark(x1)))
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


MARK(if(filter(x0, x1), y1, y2)) → A__IF(a__filter(mark(x0), mark(x1)), y1, y2)
The remaining pairs can at least be oriented weakly.

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(filter(sieve(x0), y1)) → A__FILTER(a__sieve(mark(x0)), mark(y1))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(s(x0), y1)) → A__FILTER(s(mark(x0)), mark(y1))
MARK(head(filter(x0, x1))) → A__HEAD(a__filter(mark(x0), mark(x1)))
MARK(filter(if(x0, x1, x2), y1)) → A__FILTER(a__if(mark(x0), x1, x2), mark(y1))
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(filter(filter(x0, x1), y1)) → A__FILTER(a__filter(mark(x0), mark(x1)), mark(y1))
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(filter(primes, y1)) → A__FILTER(a__primes, mark(y1))
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(filter(from(x0), y1)) → A__FILTER(a__from(mark(x0)), mark(y1))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(if(primes, y1, y2)) → A__IF(a__primes, y1, y2)
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(if(sieve(x0), y1, y2)) → A__IF(a__sieve(mark(x0)), y1, y2)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(sieve(X)) → MARK(X)
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(if(from(x0), y1, y2)) → A__IF(a__from(mark(x0)), y1, y2)
MARK(tail(filter(x0, x1))) → A__TAIL(a__filter(mark(x0), mark(x1)))
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))
Used ordering: Polynomial interpretation [25]:

POL(0) = 0   
POL(A__FILTER(x1, x2)) = x2   
POL(A__FROM(x1)) = 1   
POL(A__HEAD(x1)) = 1   
POL(A__IF(x1, x2, x3)) = x1   
POL(A__PRIMES) = 1   
POL(A__SIEVE(x1)) = 1   
POL(A__TAIL(x1)) = 1   
POL(MARK(x1)) = 1   
POL(a__filter(x1, x2)) = 0   
POL(a__from(x1)) = 1   
POL(a__head(x1)) = 1   
POL(a__if(x1, x2, x3)) = x1   
POL(a__primes) = 1   
POL(a__sieve(x1)) = x1   
POL(a__tail(x1)) = x1   
POL(cons(x1, x2)) = 1   
POL(divides(x1, x2)) = 0   
POL(false) = 1   
POL(filter(x1, x2)) = 0   
POL(from(x1)) = 0   
POL(head(x1)) = 0   
POL(if(x1, x2, x3)) = 0   
POL(mark(x1)) = 1   
POL(primes) = 1   
POL(s(x1)) = 0   
POL(sieve(x1)) = 0   
POL(tail(x1)) = 0   
POL(true) = 1   

The following usable rules [17] were oriented:

a__primesa__sieve(a__from(s(s(0))))
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
a__from(X) → cons(mark(X), from(s(X)))
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(0) → 0
mark(s(X)) → s(mark(X))
mark(from(X)) → a__from(mark(X))
mark(sieve(X)) → a__sieve(mark(X))
a__tail(cons(X, Y)) → mark(Y)
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
a__if(true, X, Y) → mark(X)
mark(tail(X)) → a__tail(mark(X))
mark(head(X)) → a__head(mark(X))
a__head(cons(X, Y)) → mark(X)
a__if(false, X, Y) → mark(Y)
a__sieve(X) → sieve(X)
a__primesprimes
a__head(X) → head(X)
a__from(X) → from(X)
mark(true) → true
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
mark(false) → false
a__filter(X1, X2) → filter(X1, X2)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
                                        ↳ QDP
                                          ↳ Narrowing
                                            ↳ QDP
                                              ↳ DependencyGraphProof
                                                ↳ QDP
                                                  ↳ Narrowing
                                                    ↳ QDP
                                                      ↳ DependencyGraphProof
                                                        ↳ QDP
                                                          ↳ QDPOrderProof
QDP
                                                              ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(filter(sieve(x0), y1)) → A__FILTER(a__sieve(mark(x0)), mark(y1))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(head(filter(x0, x1))) → A__HEAD(a__filter(mark(x0), mark(x1)))
MARK(filter(s(x0), y1)) → A__FILTER(s(mark(x0)), mark(y1))
MARK(filter(if(x0, x1, x2), y1)) → A__FILTER(a__if(mark(x0), x1, x2), mark(y1))
A__FROM(X) → MARK(X)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(filter(filter(x0, x1), y1)) → A__FILTER(a__filter(mark(x0), mark(x1)), mark(y1))
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(filter(primes, y1)) → A__FILTER(a__primes, mark(y1))
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(filter(from(x0), y1)) → A__FILTER(a__from(mark(x0)), mark(y1))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(if(primes, y1, y2)) → A__IF(a__primes, y1, y2)
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(if(sieve(x0), y1, y2)) → A__IF(a__sieve(mark(x0)), y1, y2)
MARK(divides(X1, X2)) → MARK(X1)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(sieve(X)) → MARK(X)
MARK(tail(filter(x0, x1))) → A__TAIL(a__filter(mark(x0), mark(x1)))
MARK(if(from(x0), y1, y2)) → A__IF(a__from(mark(x0)), y1, y2)
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


MARK(filter(sieve(x0), y1)) → A__FILTER(a__sieve(mark(x0)), mark(y1))
MARK(filter(filter(x0, x1), y1)) → A__FILTER(a__filter(mark(x0), mark(x1)), mark(y1))
MARK(filter(primes, y1)) → A__FILTER(a__primes, mark(y1))
The remaining pairs can at least be oriented weakly.

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(head(filter(x0, x1))) → A__HEAD(a__filter(mark(x0), mark(x1)))
MARK(filter(s(x0), y1)) → A__FILTER(s(mark(x0)), mark(y1))
MARK(filter(if(x0, x1, x2), y1)) → A__FILTER(a__if(mark(x0), x1, x2), mark(y1))
A__FROM(X) → MARK(X)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(filter(from(x0), y1)) → A__FILTER(a__from(mark(x0)), mark(y1))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(if(primes, y1, y2)) → A__IF(a__primes, y1, y2)
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(if(sieve(x0), y1, y2)) → A__IF(a__sieve(mark(x0)), y1, y2)
MARK(divides(X1, X2)) → MARK(X1)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(sieve(X)) → MARK(X)
MARK(tail(filter(x0, x1))) → A__TAIL(a__filter(mark(x0), mark(x1)))
MARK(if(from(x0), y1, y2)) → A__IF(a__from(mark(x0)), y1, y2)
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))
Used ordering: Polynomial interpretation [25]:

POL(0) = 0   
POL(A__FILTER(x1, x2)) = x1   
POL(A__FROM(x1)) = 1   
POL(A__HEAD(x1)) = 1   
POL(A__IF(x1, x2, x3)) = 1   
POL(A__PRIMES) = 1   
POL(A__SIEVE(x1)) = 1   
POL(A__TAIL(x1)) = 1   
POL(MARK(x1)) = 1   
POL(a__filter(x1, x2)) = 0   
POL(a__from(x1)) = x1   
POL(a__head(x1)) = 1   
POL(a__if(x1, x2, x3)) = x1   
POL(a__primes) = 0   
POL(a__sieve(x1)) = 0   
POL(a__tail(x1)) = 1   
POL(cons(x1, x2)) = 0   
POL(divides(x1, x2)) = 0   
POL(false) = 1   
POL(filter(x1, x2)) = 0   
POL(from(x1)) = 0   
POL(head(x1)) = 0   
POL(if(x1, x2, x3)) = 0   
POL(mark(x1)) = 1   
POL(primes) = 0   
POL(s(x1)) = 1   
POL(sieve(x1)) = 0   
POL(tail(x1)) = 0   
POL(true) = 1   

The following usable rules [17] were oriented:

a__primesa__sieve(a__from(s(s(0))))
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
a__from(X) → cons(mark(X), from(s(X)))
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(0) → 0
mark(s(X)) → s(mark(X))
mark(from(X)) → a__from(mark(X))
mark(sieve(X)) → a__sieve(mark(X))
a__tail(cons(X, Y)) → mark(Y)
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
a__if(true, X, Y) → mark(X)
mark(tail(X)) → a__tail(mark(X))
mark(head(X)) → a__head(mark(X))
a__head(cons(X, Y)) → mark(X)
a__if(false, X, Y) → mark(Y)
a__sieve(X) → sieve(X)
a__primesprimes
a__head(X) → head(X)
a__from(X) → from(X)
mark(true) → true
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
mark(false) → false
a__filter(X1, X2) → filter(X1, X2)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
                                        ↳ QDP
                                          ↳ Narrowing
                                            ↳ QDP
                                              ↳ DependencyGraphProof
                                                ↳ QDP
                                                  ↳ Narrowing
                                                    ↳ QDP
                                                      ↳ DependencyGraphProof
                                                        ↳ QDP
                                                          ↳ QDPOrderProof
                                                            ↳ QDP
                                                              ↳ QDPOrderProof
QDP
                                                                  ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(s(x0), y1)) → A__FILTER(s(mark(x0)), mark(y1))
MARK(head(filter(x0, x1))) → A__HEAD(a__filter(mark(x0), mark(x1)))
MARK(filter(if(x0, x1, x2), y1)) → A__FILTER(a__if(mark(x0), x1, x2), mark(y1))
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(filter(from(x0), y1)) → A__FILTER(a__from(mark(x0)), mark(y1))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(if(primes, y1, y2)) → A__IF(a__primes, y1, y2)
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(if(sieve(x0), y1, y2)) → A__IF(a__sieve(mark(x0)), y1, y2)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(sieve(X)) → MARK(X)
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(if(from(x0), y1, y2)) → A__IF(a__from(mark(x0)), y1, y2)
MARK(tail(filter(x0, x1))) → A__TAIL(a__filter(mark(x0), mark(x1)))
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


MARK(head(filter(x0, x1))) → A__HEAD(a__filter(mark(x0), mark(x1)))
MARK(tail(filter(x0, x1))) → A__TAIL(a__filter(mark(x0), mark(x1)))
The remaining pairs can at least be oriented weakly.

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(s(x0), y1)) → A__FILTER(s(mark(x0)), mark(y1))
MARK(filter(if(x0, x1, x2), y1)) → A__FILTER(a__if(mark(x0), x1, x2), mark(y1))
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(filter(from(x0), y1)) → A__FILTER(a__from(mark(x0)), mark(y1))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(if(primes, y1, y2)) → A__IF(a__primes, y1, y2)
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(if(sieve(x0), y1, y2)) → A__IF(a__sieve(mark(x0)), y1, y2)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(sieve(X)) → MARK(X)
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(if(from(x0), y1, y2)) → A__IF(a__from(mark(x0)), y1, y2)
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))
Used ordering: Polynomial interpretation [25]:

POL(0) = 0   
POL(A__FILTER(x1, x2)) = x2   
POL(A__FROM(x1)) = 1   
POL(A__HEAD(x1)) = x1   
POL(A__IF(x1, x2, x3)) = 1   
POL(A__PRIMES) = 1   
POL(A__SIEVE(x1)) = 1   
POL(A__TAIL(x1)) = x1   
POL(MARK(x1)) = 1   
POL(a__filter(x1, x2)) = 0   
POL(a__from(x1)) = 1   
POL(a__head(x1)) = 1   
POL(a__if(x1, x2, x3)) = x1   
POL(a__primes) = 1   
POL(a__sieve(x1)) = x1   
POL(a__tail(x1)) = 1   
POL(cons(x1, x2)) = 1   
POL(divides(x1, x2)) = 0   
POL(false) = 1   
POL(filter(x1, x2)) = 0   
POL(from(x1)) = 0   
POL(head(x1)) = 1   
POL(if(x1, x2, x3)) = 0   
POL(mark(x1)) = 1   
POL(primes) = 0   
POL(s(x1)) = 0   
POL(sieve(x1)) = 0   
POL(tail(x1)) = 0   
POL(true) = 1   

The following usable rules [17] were oriented:

a__primesa__sieve(a__from(s(s(0))))
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
a__from(X) → cons(mark(X), from(s(X)))
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(0) → 0
mark(s(X)) → s(mark(X))
mark(from(X)) → a__from(mark(X))
mark(sieve(X)) → a__sieve(mark(X))
a__tail(cons(X, Y)) → mark(Y)
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
a__if(true, X, Y) → mark(X)
mark(tail(X)) → a__tail(mark(X))
mark(head(X)) → a__head(mark(X))
a__head(cons(X, Y)) → mark(X)
a__if(false, X, Y) → mark(Y)
a__sieve(X) → sieve(X)
a__primesprimes
a__head(X) → head(X)
a__from(X) → from(X)
mark(true) → true
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
mark(false) → false
a__filter(X1, X2) → filter(X1, X2)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
                                        ↳ QDP
                                          ↳ Narrowing
                                            ↳ QDP
                                              ↳ DependencyGraphProof
                                                ↳ QDP
                                                  ↳ Narrowing
                                                    ↳ QDP
                                                      ↳ DependencyGraphProof
                                                        ↳ QDP
                                                          ↳ QDPOrderProof
                                                            ↳ QDP
                                                              ↳ QDPOrderProof
                                                                ↳ QDP
                                                                  ↳ QDPOrderProof
QDP
                                                                      ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(s(x0), y1)) → A__FILTER(s(mark(x0)), mark(y1))
MARK(filter(if(x0, x1, x2), y1)) → A__FILTER(a__if(mark(x0), x1, x2), mark(y1))
A__FROM(X) → MARK(X)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(filter(from(x0), y1)) → A__FILTER(a__from(mark(x0)), mark(y1))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(if(primes, y1, y2)) → A__IF(a__primes, y1, y2)
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(if(sieve(x0), y1, y2)) → A__IF(a__sieve(mark(x0)), y1, y2)
MARK(divides(X1, X2)) → MARK(X1)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(sieve(X)) → MARK(X)
MARK(if(from(x0), y1, y2)) → A__IF(a__from(mark(x0)), y1, y2)
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


MARK(if(primes, y1, y2)) → A__IF(a__primes, y1, y2)
MARK(if(sieve(x0), y1, y2)) → A__IF(a__sieve(mark(x0)), y1, y2)
MARK(if(from(x0), y1, y2)) → A__IF(a__from(mark(x0)), y1, y2)
The remaining pairs can at least be oriented weakly.

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(s(x0), y1)) → A__FILTER(s(mark(x0)), mark(y1))
MARK(filter(if(x0, x1, x2), y1)) → A__FILTER(a__if(mark(x0), x1, x2), mark(y1))
A__FROM(X) → MARK(X)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(filter(from(x0), y1)) → A__FILTER(a__from(mark(x0)), mark(y1))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(sieve(X)) → MARK(X)
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))
Used ordering: Polynomial interpretation [25]:

POL(0) = 0   
POL(A__FILTER(x1, x2)) = 1   
POL(A__FROM(x1)) = 1   
POL(A__HEAD(x1)) = 1   
POL(A__IF(x1, x2, x3)) = x1   
POL(A__PRIMES) = 1   
POL(A__SIEVE(x1)) = 1   
POL(A__TAIL(x1)) = 1   
POL(MARK(x1)) = 1   
POL(a__filter(x1, x2)) = 0   
POL(a__from(x1)) = 0   
POL(a__head(x1)) = 1   
POL(a__if(x1, x2, x3)) = x1   
POL(a__primes) = 0   
POL(a__sieve(x1)) = 0   
POL(a__tail(x1)) = 1   
POL(cons(x1, x2)) = 0   
POL(divides(x1, x2)) = x1   
POL(false) = 1   
POL(filter(x1, x2)) = 0   
POL(from(x1)) = 0   
POL(head(x1)) = 0   
POL(if(x1, x2, x3)) = 0   
POL(mark(x1)) = 1   
POL(primes) = 0   
POL(s(x1)) = 0   
POL(sieve(x1)) = 0   
POL(tail(x1)) = 0   
POL(true) = 1   

The following usable rules [17] were oriented:

a__primesa__sieve(a__from(s(s(0))))
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
a__from(X) → cons(mark(X), from(s(X)))
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(0) → 0
mark(s(X)) → s(mark(X))
mark(from(X)) → a__from(mark(X))
mark(sieve(X)) → a__sieve(mark(X))
a__tail(cons(X, Y)) → mark(Y)
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
a__if(true, X, Y) → mark(X)
mark(tail(X)) → a__tail(mark(X))
mark(head(X)) → a__head(mark(X))
a__head(cons(X, Y)) → mark(X)
a__if(false, X, Y) → mark(Y)
a__sieve(X) → sieve(X)
a__primesprimes
a__head(X) → head(X)
a__from(X) → from(X)
mark(true) → true
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
mark(false) → false
a__filter(X1, X2) → filter(X1, X2)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
                                        ↳ QDP
                                          ↳ Narrowing
                                            ↳ QDP
                                              ↳ DependencyGraphProof
                                                ↳ QDP
                                                  ↳ Narrowing
                                                    ↳ QDP
                                                      ↳ DependencyGraphProof
                                                        ↳ QDP
                                                          ↳ QDPOrderProof
                                                            ↳ QDP
                                                              ↳ QDPOrderProof
                                                                ↳ QDP
                                                                  ↳ QDPOrderProof
                                                                    ↳ QDP
                                                                      ↳ QDPOrderProof
QDP
                                                                          ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(s(x0), y1)) → A__FILTER(s(mark(x0)), mark(y1))
MARK(filter(if(x0, x1, x2), y1)) → A__FILTER(a__if(mark(x0), x1, x2), mark(y1))
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(filter(from(x0), y1)) → A__FILTER(a__from(mark(x0)), mark(y1))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(sieve(X)) → MARK(X)
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


MARK(sieve(filter(x0, x1))) → A__SIEVE(a__filter(mark(x0), mark(x1)))
The remaining pairs can at least be oriented weakly.

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(s(x0), y1)) → A__FILTER(s(mark(x0)), mark(y1))
MARK(filter(if(x0, x1, x2), y1)) → A__FILTER(a__if(mark(x0), x1, x2), mark(y1))
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(filter(from(x0), y1)) → A__FILTER(a__from(mark(x0)), mark(y1))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(sieve(X)) → MARK(X)
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))
Used ordering: Polynomial interpretation [25]:

POL(0) = 0   
POL(A__FILTER(x1, x2)) = 1   
POL(A__FROM(x1)) = 1   
POL(A__HEAD(x1)) = 1   
POL(A__IF(x1, x2, x3)) = x1   
POL(A__PRIMES) = 1   
POL(A__SIEVE(x1)) = x1   
POL(A__TAIL(x1)) = x1   
POL(MARK(x1)) = 1   
POL(a__filter(x1, x2)) = 0   
POL(a__from(x1)) = 1   
POL(a__head(x1)) = 1   
POL(a__if(x1, x2, x3)) = x1   
POL(a__primes) = 1   
POL(a__sieve(x1)) = 1   
POL(a__tail(x1)) = x1   
POL(cons(x1, x2)) = 1   
POL(divides(x1, x2)) = 0   
POL(false) = 1   
POL(filter(x1, x2)) = 0   
POL(from(x1)) = 1   
POL(head(x1)) = 0   
POL(if(x1, x2, x3)) = 0   
POL(mark(x1)) = 1   
POL(primes) = 1   
POL(s(x1)) = 0   
POL(sieve(x1)) = 1   
POL(tail(x1)) = x1   
POL(true) = 1   

The following usable rules [17] were oriented:

a__primesa__sieve(a__from(s(s(0))))
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
a__from(X) → cons(mark(X), from(s(X)))
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(0) → 0
mark(s(X)) → s(mark(X))
mark(from(X)) → a__from(mark(X))
mark(sieve(X)) → a__sieve(mark(X))
a__tail(cons(X, Y)) → mark(Y)
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
a__if(true, X, Y) → mark(X)
mark(tail(X)) → a__tail(mark(X))
mark(head(X)) → a__head(mark(X))
a__head(cons(X, Y)) → mark(X)
a__if(false, X, Y) → mark(Y)
a__sieve(X) → sieve(X)
a__primesprimes
a__head(X) → head(X)
a__from(X) → from(X)
mark(true) → true
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
mark(false) → false
a__filter(X1, X2) → filter(X1, X2)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
                                        ↳ QDP
                                          ↳ Narrowing
                                            ↳ QDP
                                              ↳ DependencyGraphProof
                                                ↳ QDP
                                                  ↳ Narrowing
                                                    ↳ QDP
                                                      ↳ DependencyGraphProof
                                                        ↳ QDP
                                                          ↳ QDPOrderProof
                                                            ↳ QDP
                                                              ↳ QDPOrderProof
                                                                ↳ QDP
                                                                  ↳ QDPOrderProof
                                                                    ↳ QDP
                                                                      ↳ QDPOrderProof
                                                                        ↳ QDP
                                                                          ↳ QDPOrderProof
QDP
                                                                              ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(s(x0), y1)) → A__FILTER(s(mark(x0)), mark(y1))
MARK(filter(if(x0, x1, x2), y1)) → A__FILTER(a__if(mark(x0), x1, x2), mark(y1))
A__FROM(X) → MARK(X)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(filter(from(x0), y1)) → A__FILTER(a__from(mark(x0)), mark(y1))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(sieve(X)) → MARK(X)
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


MARK(filter(from(x0), y1)) → A__FILTER(a__from(mark(x0)), mark(y1))
The remaining pairs can at least be oriented weakly.

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(s(x0), y1)) → A__FILTER(s(mark(x0)), mark(y1))
MARK(filter(if(x0, x1, x2), y1)) → A__FILTER(a__if(mark(x0), x1, x2), mark(y1))
A__FROM(X) → MARK(X)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(sieve(X)) → MARK(X)
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))
Used ordering: Polynomial interpretation [25]:

POL(0) = 1   
POL(A__FILTER(x1, x2)) = x1   
POL(A__FROM(x1)) = 1   
POL(A__HEAD(x1)) = 1   
POL(A__IF(x1, x2, x3)) = x1   
POL(A__PRIMES) = 1   
POL(A__SIEVE(x1)) = 1   
POL(A__TAIL(x1)) = 1   
POL(MARK(x1)) = 1   
POL(a__filter(x1, x2)) = 0   
POL(a__from(x1)) = 0   
POL(a__head(x1)) = 1   
POL(a__if(x1, x2, x3)) = x1   
POL(a__primes) = 0   
POL(a__sieve(x1)) = 0   
POL(a__tail(x1)) = 1   
POL(cons(x1, x2)) = 0   
POL(divides(x1, x2)) = 0   
POL(false) = 1   
POL(filter(x1, x2)) = 0   
POL(from(x1)) = 0   
POL(head(x1)) = 0   
POL(if(x1, x2, x3)) = 0   
POL(mark(x1)) = 1   
POL(primes) = 0   
POL(s(x1)) = 1   
POL(sieve(x1)) = 0   
POL(tail(x1)) = 0   
POL(true) = 1   

The following usable rules [17] were oriented:

a__primesa__sieve(a__from(s(s(0))))
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
a__from(X) → cons(mark(X), from(s(X)))
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(0) → 0
mark(s(X)) → s(mark(X))
mark(from(X)) → a__from(mark(X))
mark(sieve(X)) → a__sieve(mark(X))
a__tail(cons(X, Y)) → mark(Y)
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
a__if(true, X, Y) → mark(X)
mark(tail(X)) → a__tail(mark(X))
mark(head(X)) → a__head(mark(X))
a__head(cons(X, Y)) → mark(X)
a__if(false, X, Y) → mark(Y)
a__sieve(X) → sieve(X)
a__primesprimes
a__head(X) → head(X)
a__from(X) → from(X)
mark(true) → true
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
mark(false) → false
a__filter(X1, X2) → filter(X1, X2)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
                                        ↳ QDP
                                          ↳ Narrowing
                                            ↳ QDP
                                              ↳ DependencyGraphProof
                                                ↳ QDP
                                                  ↳ Narrowing
                                                    ↳ QDP
                                                      ↳ DependencyGraphProof
                                                        ↳ QDP
                                                          ↳ QDPOrderProof
                                                            ↳ QDP
                                                              ↳ QDPOrderProof
                                                                ↳ QDP
                                                                  ↳ QDPOrderProof
                                                                    ↳ QDP
                                                                      ↳ QDPOrderProof
                                                                        ↳ QDP
                                                                          ↳ QDPOrderProof
                                                                            ↳ QDP
                                                                              ↳ QDPOrderProof
QDP
                                                                                  ↳ Narrowing

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(s(x0), y1)) → A__FILTER(s(mark(x0)), mark(y1))
MARK(filter(if(x0, x1, x2), y1)) → A__FILTER(a__if(mark(x0), x1, x2), mark(y1))
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(sieve(X)) → MARK(X)
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By narrowing [15] the rule MARK(filter(s(x0), y1)) → A__FILTER(s(mark(x0)), mark(y1)) at position [1] we obtained the following new rules:

MARK(filter(s(y0), s(x0))) → A__FILTER(s(mark(y0)), s(mark(x0)))
MARK(filter(s(y0), tail(x0))) → A__FILTER(s(mark(y0)), a__tail(mark(x0)))
MARK(filter(s(y0), if(x0, x1, x2))) → A__FILTER(s(mark(y0)), a__if(mark(x0), x1, x2))
MARK(filter(s(y0), true)) → A__FILTER(s(mark(y0)), true)
MARK(filter(s(y0), false)) → A__FILTER(s(mark(y0)), false)
MARK(filter(s(y0), head(x0))) → A__FILTER(s(mark(y0)), a__head(mark(x0)))
MARK(filter(s(y0), cons(x0, x1))) → A__FILTER(s(mark(y0)), cons(mark(x0), x1))
MARK(filter(s(y0), 0)) → A__FILTER(s(mark(y0)), 0)
MARK(filter(s(y0), sieve(x0))) → A__FILTER(s(mark(y0)), a__sieve(mark(x0)))
MARK(filter(s(y0), filter(x0, x1))) → A__FILTER(s(mark(y0)), a__filter(mark(x0), mark(x1)))
MARK(filter(s(y0), primes)) → A__FILTER(s(mark(y0)), a__primes)
MARK(filter(s(y0), from(x0))) → A__FILTER(s(mark(y0)), a__from(mark(x0)))
MARK(filter(s(y0), divides(x0, x1))) → A__FILTER(s(mark(y0)), divides(mark(x0), mark(x1)))



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
                                        ↳ QDP
                                          ↳ Narrowing
                                            ↳ QDP
                                              ↳ DependencyGraphProof
                                                ↳ QDP
                                                  ↳ Narrowing
                                                    ↳ QDP
                                                      ↳ DependencyGraphProof
                                                        ↳ QDP
                                                          ↳ QDPOrderProof
                                                            ↳ QDP
                                                              ↳ QDPOrderProof
                                                                ↳ QDP
                                                                  ↳ QDPOrderProof
                                                                    ↳ QDP
                                                                      ↳ QDPOrderProof
                                                                        ↳ QDP
                                                                          ↳ QDPOrderProof
                                                                            ↳ QDP
                                                                              ↳ QDPOrderProof
                                                                                ↳ QDP
                                                                                  ↳ Narrowing
QDP
                                                                                      ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(filter(s(y0), tail(x0))) → A__FILTER(s(mark(y0)), a__tail(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(tail(X)) → MARK(X)
MARK(head(X)) → MARK(X)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(filter(s(y0), cons(x0, x1))) → A__FILTER(s(mark(y0)), cons(mark(x0), x1))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(filter(s(y0), from(x0))) → A__FILTER(s(mark(y0)), a__from(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(s(y0), true)) → A__FILTER(s(mark(y0)), true)
MARK(filter(if(x0, x1, x2), y1)) → A__FILTER(a__if(mark(x0), x1, x2), mark(y1))
MARK(filter(s(y0), false)) → A__FILTER(s(mark(y0)), false)
A__FROM(X) → MARK(X)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(filter(s(y0), divides(x0, x1))) → A__FILTER(s(mark(y0)), divides(mark(x0), mark(x1)))
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(filter(X1, X2)) → MARK(X2)
MARK(s(X)) → MARK(X)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(filter(s(y0), 0)) → A__FILTER(s(mark(y0)), 0)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(filter(s(y0), filter(x0, x1))) → A__FILTER(s(mark(y0)), a__filter(mark(x0), mark(x1)))
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1))
MARK(filter(s(y0), s(x0))) → A__FILTER(s(mark(y0)), s(mark(x0)))
MARK(from(X)) → MARK(X)
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(filter(s(y0), if(x0, x1, x2))) → A__FILTER(s(mark(y0)), a__if(mark(x0), x1, x2))
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(primes) → A__PRIMES
MARK(divides(X1, X2)) → MARK(X2)
A__IF(true, X, Y) → MARK(X)
MARK(filter(X1, X2)) → MARK(X1)
MARK(filter(s(y0), head(x0))) → A__FILTER(s(mark(y0)), a__head(mark(x0)))
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(filter(s(y0), sieve(x0))) → A__FILTER(s(mark(y0)), a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(filter(s(y0), primes)) → A__FILTER(s(mark(y0)), a__primes)
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(sieve(X)) → MARK(X)
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 5 less nodes.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
                                        ↳ QDP
                                          ↳ Narrowing
                                            ↳ QDP
                                              ↳ DependencyGraphProof
                                                ↳ QDP
                                                  ↳ Narrowing
                                                    ↳ QDP
                                                      ↳ DependencyGraphProof
                                                        ↳ QDP
                                                          ↳ QDPOrderProof
                                                            ↳ QDP
                                                              ↳ QDPOrderProof
                                                                ↳ QDP
                                                                  ↳ QDPOrderProof
                                                                    ↳ QDP
                                                                      ↳ QDPOrderProof
                                                                        ↳ QDP
                                                                          ↳ QDPOrderProof
                                                                            ↳ QDP
                                                                              ↳ QDPOrderProof
                                                                                ↳ QDP
                                                                                  ↳ Narrowing
                                                                                    ↳ QDP
                                                                                      ↳ DependencyGraphProof
QDP
                                                                                          ↳ Narrowing

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(filter(s(y0), tail(x0))) → A__FILTER(s(mark(y0)), a__tail(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(filter(s(y0), cons(x0, x1))) → A__FILTER(s(mark(y0)), cons(mark(x0), x1))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(filter(s(y0), from(x0))) → A__FILTER(s(mark(y0)), a__from(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(if(x0, x1, x2), y1)) → A__FILTER(a__if(mark(x0), x1, x2), mark(y1))
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(filter(X1, X2)) → MARK(X2)
MARK(s(X)) → MARK(X)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(filter(s(y0), filter(x0, x1))) → A__FILTER(s(mark(y0)), a__filter(mark(x0), mark(x1)))
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(filter(s(y0), if(x0, x1, x2))) → A__FILTER(s(mark(y0)), a__if(mark(x0), x1, x2))
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(filter(s(y0), head(x0))) → A__FILTER(s(mark(y0)), a__head(mark(x0)))
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(filter(s(y0), sieve(x0))) → A__FILTER(s(mark(y0)), a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(filter(s(y0), primes)) → A__FILTER(s(mark(y0)), a__primes)
MARK(sieve(X)) → MARK(X)
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By narrowing [15] the rule MARK(filter(if(x0, x1, x2), y1)) → A__FILTER(a__if(mark(x0), x1, x2), mark(y1)) at position [1] we obtained the following new rules:

MARK(filter(if(y0, y1, y2), cons(x0, x1))) → A__FILTER(a__if(mark(y0), y1, y2), cons(mark(x0), x1))
MARK(filter(if(y0, y1, y2), head(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__head(mark(x0)))
MARK(filter(if(y0, y1, y2), primes)) → A__FILTER(a__if(mark(y0), y1, y2), a__primes)
MARK(filter(if(y0, y1, y2), tail(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__tail(mark(x0)))
MARK(filter(if(y0, y1, y2), s(x0))) → A__FILTER(a__if(mark(y0), y1, y2), s(mark(x0)))
MARK(filter(if(y0, y1, y2), 0)) → A__FILTER(a__if(mark(y0), y1, y2), 0)
MARK(filter(if(y0, y1, y2), divides(x0, x1))) → A__FILTER(a__if(mark(y0), y1, y2), divides(mark(x0), mark(x1)))
MARK(filter(if(y0, y1, y2), if(x0, x1, x2))) → A__FILTER(a__if(mark(y0), y1, y2), a__if(mark(x0), x1, x2))
MARK(filter(if(y0, y1, y2), true)) → A__FILTER(a__if(mark(y0), y1, y2), true)
MARK(filter(if(y0, y1, y2), false)) → A__FILTER(a__if(mark(y0), y1, y2), false)
MARK(filter(if(y0, y1, y2), sieve(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__sieve(mark(x0)))
MARK(filter(if(y0, y1, y2), filter(x0, x1))) → A__FILTER(a__if(mark(y0), y1, y2), a__filter(mark(x0), mark(x1)))
MARK(filter(if(y0, y1, y2), from(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__from(mark(x0)))



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
                                        ↳ QDP
                                          ↳ Narrowing
                                            ↳ QDP
                                              ↳ DependencyGraphProof
                                                ↳ QDP
                                                  ↳ Narrowing
                                                    ↳ QDP
                                                      ↳ DependencyGraphProof
                                                        ↳ QDP
                                                          ↳ QDPOrderProof
                                                            ↳ QDP
                                                              ↳ QDPOrderProof
                                                                ↳ QDP
                                                                  ↳ QDPOrderProof
                                                                    ↳ QDP
                                                                      ↳ QDPOrderProof
                                                                        ↳ QDP
                                                                          ↳ QDPOrderProof
                                                                            ↳ QDP
                                                                              ↳ QDPOrderProof
                                                                                ↳ QDP
                                                                                  ↳ Narrowing
                                                                                    ↳ QDP
                                                                                      ↳ DependencyGraphProof
                                                                                        ↳ QDP
                                                                                          ↳ Narrowing
QDP
                                                                                              ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(filter(s(y0), tail(x0))) → A__FILTER(s(mark(y0)), a__tail(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(filter(if(y0, y1, y2), head(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__head(mark(x0)))
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(tail(X)) → MARK(X)
MARK(head(X)) → MARK(X)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(filter(s(y0), cons(x0, x1))) → A__FILTER(s(mark(y0)), cons(mark(x0), x1))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(filter(s(y0), from(x0))) → A__FILTER(s(mark(y0)), a__from(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(if(y0, y1, y2), cons(x0, x1))) → A__FILTER(a__if(mark(y0), y1, y2), cons(mark(x0), x1))
MARK(filter(if(y0, y1, y2), primes)) → A__FILTER(a__if(mark(y0), y1, y2), a__primes)
MARK(filter(if(y0, y1, y2), 0)) → A__FILTER(a__if(mark(y0), y1, y2), 0)
A__FROM(X) → MARK(X)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
MARK(filter(if(y0, y1, y2), divides(x0, x1))) → A__FILTER(a__if(mark(y0), y1, y2), divides(mark(x0), mark(x1)))
MARK(filter(if(y0, y1, y2), true)) → A__FILTER(a__if(mark(y0), y1, y2), true)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(filter(if(y0, y1, y2), from(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__from(mark(x0)))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(filter(if(y0, y1, y2), if(x0, x1, x2))) → A__FILTER(a__if(mark(y0), y1, y2), a__if(mark(x0), x1, x2))
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(filter(s(y0), filter(x0, x1))) → A__FILTER(s(mark(y0)), a__filter(mark(x0), mark(x1)))
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(if(y0, y1, y2), filter(x0, x1))) → A__FILTER(a__if(mark(y0), y1, y2), a__filter(mark(x0), mark(x1)))
MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1))
MARK(from(X)) → MARK(X)
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(filter(s(y0), if(x0, x1, x2))) → A__FILTER(s(mark(y0)), a__if(mark(x0), x1, x2))
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(primes) → A__PRIMES
MARK(divides(X1, X2)) → MARK(X2)
MARK(filter(if(y0, y1, y2), tail(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__tail(mark(x0)))
MARK(filter(if(y0, y1, y2), s(x0))) → A__FILTER(a__if(mark(y0), y1, y2), s(mark(x0)))
A__IF(true, X, Y) → MARK(X)
MARK(filter(X1, X2)) → MARK(X1)
MARK(filter(s(y0), head(x0))) → A__FILTER(s(mark(y0)), a__head(mark(x0)))
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(filter(s(y0), sieve(x0))) → A__FILTER(s(mark(y0)), a__sieve(mark(x0)))
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(filter(s(y0), primes)) → A__FILTER(s(mark(y0)), a__primes)
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(sieve(X)) → MARK(X)
MARK(filter(if(y0, y1, y2), false)) → A__FILTER(a__if(mark(y0), y1, y2), false)
MARK(filter(if(y0, y1, y2), sieve(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__sieve(mark(x0)))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 5 less nodes.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
                                        ↳ QDP
                                          ↳ Narrowing
                                            ↳ QDP
                                              ↳ DependencyGraphProof
                                                ↳ QDP
                                                  ↳ Narrowing
                                                    ↳ QDP
                                                      ↳ DependencyGraphProof
                                                        ↳ QDP
                                                          ↳ QDPOrderProof
                                                            ↳ QDP
                                                              ↳ QDPOrderProof
                                                                ↳ QDP
                                                                  ↳ QDPOrderProof
                                                                    ↳ QDP
                                                                      ↳ QDPOrderProof
                                                                        ↳ QDP
                                                                          ↳ QDPOrderProof
                                                                            ↳ QDP
                                                                              ↳ QDPOrderProof
                                                                                ↳ QDP
                                                                                  ↳ Narrowing
                                                                                    ↳ QDP
                                                                                      ↳ DependencyGraphProof
                                                                                        ↳ QDP
                                                                                          ↳ Narrowing
                                                                                            ↳ QDP
                                                                                              ↳ DependencyGraphProof
QDP
                                                                                                  ↳ Narrowing

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(filter(s(y0), tail(x0))) → A__FILTER(s(mark(y0)), a__tail(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(filter(if(y0, y1, y2), head(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__head(mark(x0)))
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(filter(s(y0), cons(x0, x1))) → A__FILTER(s(mark(y0)), cons(mark(x0), x1))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(filter(s(y0), from(x0))) → A__FILTER(s(mark(y0)), a__from(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(if(y0, y1, y2), cons(x0, x1))) → A__FILTER(a__if(mark(y0), y1, y2), cons(mark(x0), x1))
MARK(filter(if(y0, y1, y2), primes)) → A__FILTER(a__if(mark(y0), y1, y2), a__primes)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(filter(if(y0, y1, y2), from(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__from(mark(x0)))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(filter(X1, X2)) → MARK(X2)
MARK(s(X)) → MARK(X)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(filter(if(y0, y1, y2), if(x0, x1, x2))) → A__FILTER(a__if(mark(y0), y1, y2), a__if(mark(x0), x1, x2))
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(filter(s(y0), filter(x0, x1))) → A__FILTER(s(mark(y0)), a__filter(mark(x0), mark(x1)))
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(if(y0, y1, y2), filter(x0, x1))) → A__FILTER(a__if(mark(y0), y1, y2), a__filter(mark(x0), mark(x1)))
MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(filter(s(y0), if(x0, x1, x2))) → A__FILTER(s(mark(y0)), a__if(mark(x0), x1, x2))
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(filter(if(y0, y1, y2), tail(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__tail(mark(x0)))
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(filter(s(y0), head(x0))) → A__FILTER(s(mark(y0)), a__head(mark(x0)))
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(filter(s(y0), sieve(x0))) → A__FILTER(s(mark(y0)), a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(filter(s(y0), primes)) → A__FILTER(s(mark(y0)), a__primes)
MARK(sieve(X)) → MARK(X)
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(filter(if(y0, y1, y2), sieve(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__sieve(mark(x0)))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By narrowing [15] the rule MARK(filter(tail(x0), y1)) → A__FILTER(a__tail(mark(x0)), mark(y1)) at position [1] we obtained the following new rules:

MARK(filter(tail(y0), s(x0))) → A__FILTER(a__tail(mark(y0)), s(mark(x0)))
MARK(filter(tail(y0), filter(x0, x1))) → A__FILTER(a__tail(mark(y0)), a__filter(mark(x0), mark(x1)))
MARK(filter(tail(y0), head(x0))) → A__FILTER(a__tail(mark(y0)), a__head(mark(x0)))
MARK(filter(tail(y0), true)) → A__FILTER(a__tail(mark(y0)), true)
MARK(filter(tail(y0), from(x0))) → A__FILTER(a__tail(mark(y0)), a__from(mark(x0)))
MARK(filter(tail(y0), divides(x0, x1))) → A__FILTER(a__tail(mark(y0)), divides(mark(x0), mark(x1)))
MARK(filter(tail(y0), false)) → A__FILTER(a__tail(mark(y0)), false)
MARK(filter(tail(y0), 0)) → A__FILTER(a__tail(mark(y0)), 0)
MARK(filter(tail(y0), if(x0, x1, x2))) → A__FILTER(a__tail(mark(y0)), a__if(mark(x0), x1, x2))
MARK(filter(tail(y0), tail(x0))) → A__FILTER(a__tail(mark(y0)), a__tail(mark(x0)))
MARK(filter(tail(y0), sieve(x0))) → A__FILTER(a__tail(mark(y0)), a__sieve(mark(x0)))
MARK(filter(tail(y0), primes)) → A__FILTER(a__tail(mark(y0)), a__primes)
MARK(filter(tail(y0), cons(x0, x1))) → A__FILTER(a__tail(mark(y0)), cons(mark(x0), x1))



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
                                        ↳ QDP
                                          ↳ Narrowing
                                            ↳ QDP
                                              ↳ DependencyGraphProof
                                                ↳ QDP
                                                  ↳ Narrowing
                                                    ↳ QDP
                                                      ↳ DependencyGraphProof
                                                        ↳ QDP
                                                          ↳ QDPOrderProof
                                                            ↳ QDP
                                                              ↳ QDPOrderProof
                                                                ↳ QDP
                                                                  ↳ QDPOrderProof
                                                                    ↳ QDP
                                                                      ↳ QDPOrderProof
                                                                        ↳ QDP
                                                                          ↳ QDPOrderProof
                                                                            ↳ QDP
                                                                              ↳ QDPOrderProof
                                                                                ↳ QDP
                                                                                  ↳ Narrowing
                                                                                    ↳ QDP
                                                                                      ↳ DependencyGraphProof
                                                                                        ↳ QDP
                                                                                          ↳ Narrowing
                                                                                            ↳ QDP
                                                                                              ↳ DependencyGraphProof
                                                                                                ↳ QDP
                                                                                                  ↳ Narrowing
QDP
                                                                                                      ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(filter(tail(y0), filter(x0, x1))) → A__FILTER(a__tail(mark(y0)), a__filter(mark(x0), mark(x1)))
MARK(filter(tail(y0), s(x0))) → A__FILTER(a__tail(mark(y0)), s(mark(x0)))
MARK(filter(s(y0), tail(x0))) → A__FILTER(s(mark(y0)), a__tail(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(filter(tail(y0), head(x0))) → A__FILTER(a__tail(mark(y0)), a__head(mark(x0)))
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(tail(X)) → MARK(X)
MARK(head(X)) → MARK(X)
MARK(filter(if(y0, y1, y2), head(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__head(mark(x0)))
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(filter(tail(y0), from(x0))) → A__FILTER(a__tail(mark(y0)), a__from(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(filter(s(y0), cons(x0, x1))) → A__FILTER(s(mark(y0)), cons(mark(x0), x1))
MARK(filter(tail(y0), 0)) → A__FILTER(a__tail(mark(y0)), 0)
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(filter(tail(y0), if(x0, x1, x2))) → A__FILTER(a__tail(mark(y0)), a__if(mark(x0), x1, x2))
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(filter(s(y0), from(x0))) → A__FILTER(s(mark(y0)), a__from(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(if(y0, y1, y2), cons(x0, x1))) → A__FILTER(a__if(mark(y0), y1, y2), cons(mark(x0), x1))
MARK(filter(if(y0, y1, y2), primes)) → A__FILTER(a__if(mark(y0), y1, y2), a__primes)
A__FROM(X) → MARK(X)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
MARK(filter(tail(y0), divides(x0, x1))) → A__FILTER(a__tail(mark(y0)), divides(mark(x0), mark(x1)))
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(filter(tail(y0), primes)) → A__FILTER(a__tail(mark(y0)), a__primes)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(filter(if(y0, y1, y2), from(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__from(mark(x0)))
MARK(filter(tail(y0), cons(x0, x1))) → A__FILTER(a__tail(mark(y0)), cons(mark(x0), x1))
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
MARK(filter(tail(y0), true)) → A__FILTER(a__tail(mark(y0)), true)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(filter(if(y0, y1, y2), if(x0, x1, x2))) → A__FILTER(a__if(mark(y0), y1, y2), a__if(mark(x0), x1, x2))
MARK(head(primes)) → A__HEAD(a__primes)
MARK(filter(s(y0), filter(x0, x1))) → A__FILTER(s(mark(y0)), a__filter(mark(x0), mark(x1)))
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(y0), sieve(x0))) → A__FILTER(a__tail(mark(y0)), a__sieve(mark(x0)))
MARK(filter(if(y0, y1, y2), filter(x0, x1))) → A__FILTER(a__if(mark(y0), y1, y2), a__filter(mark(x0), mark(x1)))
MARK(from(X)) → MARK(X)
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(filter(s(y0), if(x0, x1, x2))) → A__FILTER(s(mark(y0)), a__if(mark(x0), x1, x2))
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(primes) → A__PRIMES
MARK(divides(X1, X2)) → MARK(X2)
MARK(filter(if(y0, y1, y2), tail(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__tail(mark(x0)))
A__IF(true, X, Y) → MARK(X)
MARK(filter(X1, X2)) → MARK(X1)
MARK(filter(s(y0), head(x0))) → A__FILTER(s(mark(y0)), a__head(mark(x0)))
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(filter(tail(y0), false)) → A__FILTER(a__tail(mark(y0)), false)
MARK(divides(X1, X2)) → MARK(X1)
MARK(filter(s(y0), sieve(x0))) → A__FILTER(s(mark(y0)), a__sieve(mark(x0)))
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(filter(tail(y0), tail(x0))) → A__FILTER(a__tail(mark(y0)), a__tail(mark(x0)))
MARK(filter(s(y0), primes)) → A__FILTER(s(mark(y0)), a__primes)
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(sieve(X)) → MARK(X)
MARK(filter(if(y0, y1, y2), sieve(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__sieve(mark(x0)))
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 5 less nodes.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
                                        ↳ QDP
                                          ↳ Narrowing
                                            ↳ QDP
                                              ↳ DependencyGraphProof
                                                ↳ QDP
                                                  ↳ Narrowing
                                                    ↳ QDP
                                                      ↳ DependencyGraphProof
                                                        ↳ QDP
                                                          ↳ QDPOrderProof
                                                            ↳ QDP
                                                              ↳ QDPOrderProof
                                                                ↳ QDP
                                                                  ↳ QDPOrderProof
                                                                    ↳ QDP
                                                                      ↳ QDPOrderProof
                                                                        ↳ QDP
                                                                          ↳ QDPOrderProof
                                                                            ↳ QDP
                                                                              ↳ QDPOrderProof
                                                                                ↳ QDP
                                                                                  ↳ Narrowing
                                                                                    ↳ QDP
                                                                                      ↳ DependencyGraphProof
                                                                                        ↳ QDP
                                                                                          ↳ Narrowing
                                                                                            ↳ QDP
                                                                                              ↳ DependencyGraphProof
                                                                                                ↳ QDP
                                                                                                  ↳ Narrowing
                                                                                                    ↳ QDP
                                                                                                      ↳ DependencyGraphProof
QDP
                                                                                                          ↳ Narrowing

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(filter(tail(y0), filter(x0, x1))) → A__FILTER(a__tail(mark(y0)), a__filter(mark(x0), mark(x1)))
MARK(filter(s(y0), tail(x0))) → A__FILTER(s(mark(y0)), a__tail(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(filter(tail(y0), head(x0))) → A__FILTER(a__tail(mark(y0)), a__head(mark(x0)))
MARK(filter(if(y0, y1, y2), head(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__head(mark(x0)))
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(filter(tail(y0), from(x0))) → A__FILTER(a__tail(mark(y0)), a__from(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(filter(s(y0), cons(x0, x1))) → A__FILTER(s(mark(y0)), cons(mark(x0), x1))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(filter(tail(y0), if(x0, x1, x2))) → A__FILTER(a__tail(mark(y0)), a__if(mark(x0), x1, x2))
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(filter(s(y0), from(x0))) → A__FILTER(s(mark(y0)), a__from(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(if(y0, y1, y2), cons(x0, x1))) → A__FILTER(a__if(mark(y0), y1, y2), cons(mark(x0), x1))
MARK(filter(if(y0, y1, y2), primes)) → A__FILTER(a__if(mark(y0), y1, y2), a__primes)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(filter(tail(y0), primes)) → A__FILTER(a__tail(mark(y0)), a__primes)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(filter(if(y0, y1, y2), from(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__from(mark(x0)))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(filter(tail(y0), cons(x0, x1))) → A__FILTER(a__tail(mark(y0)), cons(mark(x0), x1))
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(filter(if(y0, y1, y2), if(x0, x1, x2))) → A__FILTER(a__if(mark(y0), y1, y2), a__if(mark(x0), x1, x2))
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(filter(s(y0), filter(x0, x1))) → A__FILTER(s(mark(y0)), a__filter(mark(x0), mark(x1)))
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(y0), sieve(x0))) → A__FILTER(a__tail(mark(y0)), a__sieve(mark(x0)))
MARK(filter(if(y0, y1, y2), filter(x0, x1))) → A__FILTER(a__if(mark(y0), y1, y2), a__filter(mark(x0), mark(x1)))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(filter(s(y0), if(x0, x1, x2))) → A__FILTER(s(mark(y0)), a__if(mark(x0), x1, x2))
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(filter(if(y0, y1, y2), tail(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__tail(mark(x0)))
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(filter(s(y0), head(x0))) → A__FILTER(s(mark(y0)), a__head(mark(x0)))
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(filter(s(y0), sieve(x0))) → A__FILTER(s(mark(y0)), a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(filter(tail(y0), tail(x0))) → A__FILTER(a__tail(mark(y0)), a__tail(mark(x0)))
MARK(filter(s(y0), primes)) → A__FILTER(s(mark(y0)), a__primes)
MARK(sieve(X)) → MARK(X)
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(filter(if(y0, y1, y2), sieve(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__sieve(mark(x0)))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))
MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By narrowing [15] the rule MARK(filter(head(x0), y1)) → A__FILTER(a__head(mark(x0)), mark(y1)) at position [1] we obtained the following new rules:

MARK(filter(head(y0), true)) → A__FILTER(a__head(mark(y0)), true)
MARK(filter(head(y0), if(x0, x1, x2))) → A__FILTER(a__head(mark(y0)), a__if(mark(x0), x1, x2))
MARK(filter(head(y0), tail(x0))) → A__FILTER(a__head(mark(y0)), a__tail(mark(x0)))
MARK(filter(head(y0), sieve(x0))) → A__FILTER(a__head(mark(y0)), a__sieve(mark(x0)))
MARK(filter(head(y0), 0)) → A__FILTER(a__head(mark(y0)), 0)
MARK(filter(head(y0), primes)) → A__FILTER(a__head(mark(y0)), a__primes)
MARK(filter(head(y0), divides(x0, x1))) → A__FILTER(a__head(mark(y0)), divides(mark(x0), mark(x1)))
MARK(filter(head(y0), s(x0))) → A__FILTER(a__head(mark(y0)), s(mark(x0)))
MARK(filter(head(y0), head(x0))) → A__FILTER(a__head(mark(y0)), a__head(mark(x0)))
MARK(filter(head(y0), from(x0))) → A__FILTER(a__head(mark(y0)), a__from(mark(x0)))
MARK(filter(head(y0), cons(x0, x1))) → A__FILTER(a__head(mark(y0)), cons(mark(x0), x1))
MARK(filter(head(y0), false)) → A__FILTER(a__head(mark(y0)), false)
MARK(filter(head(y0), filter(x0, x1))) → A__FILTER(a__head(mark(y0)), a__filter(mark(x0), mark(x1)))



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
                                        ↳ QDP
                                          ↳ Narrowing
                                            ↳ QDP
                                              ↳ DependencyGraphProof
                                                ↳ QDP
                                                  ↳ Narrowing
                                                    ↳ QDP
                                                      ↳ DependencyGraphProof
                                                        ↳ QDP
                                                          ↳ QDPOrderProof
                                                            ↳ QDP
                                                              ↳ QDPOrderProof
                                                                ↳ QDP
                                                                  ↳ QDPOrderProof
                                                                    ↳ QDP
                                                                      ↳ QDPOrderProof
                                                                        ↳ QDP
                                                                          ↳ QDPOrderProof
                                                                            ↳ QDP
                                                                              ↳ QDPOrderProof
                                                                                ↳ QDP
                                                                                  ↳ Narrowing
                                                                                    ↳ QDP
                                                                                      ↳ DependencyGraphProof
                                                                                        ↳ QDP
                                                                                          ↳ Narrowing
                                                                                            ↳ QDP
                                                                                              ↳ DependencyGraphProof
                                                                                                ↳ QDP
                                                                                                  ↳ Narrowing
                                                                                                    ↳ QDP
                                                                                                      ↳ DependencyGraphProof
                                                                                                        ↳ QDP
                                                                                                          ↳ Narrowing
QDP
                                                                                                              ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(filter(s(y0), tail(x0))) → A__FILTER(s(mark(y0)), a__tail(mark(x0)))
MARK(filter(tail(y0), filter(x0, x1))) → A__FILTER(a__tail(mark(y0)), a__filter(mark(x0), mark(x1)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(filter(head(y0), if(x0, x1, x2))) → A__FILTER(a__head(mark(y0)), a__if(mark(x0), x1, x2))
MARK(filter(head(y0), true)) → A__FILTER(a__head(mark(y0)), true)
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(filter(head(y0), tail(x0))) → A__FILTER(a__head(mark(y0)), a__tail(mark(x0)))
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(tail(X)) → MARK(X)
MARK(head(X)) → MARK(X)
MARK(filter(if(y0, y1, y2), head(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__head(mark(x0)))
MARK(filter(tail(y0), head(x0))) → A__FILTER(a__tail(mark(y0)), a__head(mark(x0)))
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(filter(head(y0), 0)) → A__FILTER(a__head(mark(y0)), 0)
MARK(filter(head(y0), primes)) → A__FILTER(a__head(mark(y0)), a__primes)
MARK(filter(head(y0), divides(x0, x1))) → A__FILTER(a__head(mark(y0)), divides(mark(x0), mark(x1)))
MARK(filter(tail(y0), from(x0))) → A__FILTER(a__tail(mark(y0)), a__from(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(filter(s(y0), cons(x0, x1))) → A__FILTER(s(mark(y0)), cons(mark(x0), x1))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(filter(tail(y0), if(x0, x1, x2))) → A__FILTER(a__tail(mark(y0)), a__if(mark(x0), x1, x2))
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(filter(head(y0), false)) → A__FILTER(a__head(mark(y0)), false)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(filter(head(y0), filter(x0, x1))) → A__FILTER(a__head(mark(y0)), a__filter(mark(x0), mark(x1)))
MARK(filter(s(y0), from(x0))) → A__FILTER(s(mark(y0)), a__from(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(if(y0, y1, y2), cons(x0, x1))) → A__FILTER(a__if(mark(y0), y1, y2), cons(mark(x0), x1))
MARK(filter(if(y0, y1, y2), primes)) → A__FILTER(a__if(mark(y0), y1, y2), a__primes)
A__FROM(X) → MARK(X)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(filter(tail(y0), primes)) → A__FILTER(a__tail(mark(y0)), a__primes)
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(filter(if(y0, y1, y2), from(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__from(mark(x0)))
MARK(filter(tail(y0), cons(x0, x1))) → A__FILTER(a__tail(mark(y0)), cons(mark(x0), x1))
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(filter(X1, X2)) → MARK(X2)
MARK(s(X)) → MARK(X)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(filter(if(y0, y1, y2), if(x0, x1, x2))) → A__FILTER(a__if(mark(y0), y1, y2), a__if(mark(x0), x1, x2))
MARK(head(primes)) → A__HEAD(a__primes)
MARK(filter(s(y0), filter(x0, x1))) → A__FILTER(s(mark(y0)), a__filter(mark(x0), mark(x1)))
MARK(filter(head(y0), cons(x0, x1))) → A__FILTER(a__head(mark(y0)), cons(mark(x0), x1))
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(y0), sieve(x0))) → A__FILTER(a__tail(mark(y0)), a__sieve(mark(x0)))
MARK(filter(if(y0, y1, y2), filter(x0, x1))) → A__FILTER(a__if(mark(y0), y1, y2), a__filter(mark(x0), mark(x1)))
MARK(from(X)) → MARK(X)
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(filter(s(y0), if(x0, x1, x2))) → A__FILTER(s(mark(y0)), a__if(mark(x0), x1, x2))
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(primes) → A__PRIMES
MARK(divides(X1, X2)) → MARK(X2)
MARK(filter(head(y0), sieve(x0))) → A__FILTER(a__head(mark(y0)), a__sieve(mark(x0)))
MARK(filter(if(y0, y1, y2), tail(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__tail(mark(x0)))
A__IF(true, X, Y) → MARK(X)
MARK(filter(X1, X2)) → MARK(X1)
MARK(filter(head(y0), s(x0))) → A__FILTER(a__head(mark(y0)), s(mark(x0)))
MARK(filter(s(y0), head(x0))) → A__FILTER(s(mark(y0)), a__head(mark(x0)))
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(filter(head(y0), head(x0))) → A__FILTER(a__head(mark(y0)), a__head(mark(x0)))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(filter(s(y0), sieve(x0))) → A__FILTER(s(mark(y0)), a__sieve(mark(x0)))
MARK(filter(head(y0), from(x0))) → A__FILTER(a__head(mark(y0)), a__from(mark(x0)))
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(filter(s(y0), primes)) → A__FILTER(s(mark(y0)), a__primes)
MARK(filter(tail(y0), tail(x0))) → A__FILTER(a__tail(mark(y0)), a__tail(mark(x0)))
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(sieve(X)) → MARK(X)
MARK(filter(if(y0, y1, y2), sieve(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__sieve(mark(x0)))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 5 less nodes.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
                                        ↳ QDP
                                          ↳ Narrowing
                                            ↳ QDP
                                              ↳ DependencyGraphProof
                                                ↳ QDP
                                                  ↳ Narrowing
                                                    ↳ QDP
                                                      ↳ DependencyGraphProof
                                                        ↳ QDP
                                                          ↳ QDPOrderProof
                                                            ↳ QDP
                                                              ↳ QDPOrderProof
                                                                ↳ QDP
                                                                  ↳ QDPOrderProof
                                                                    ↳ QDP
                                                                      ↳ QDPOrderProof
                                                                        ↳ QDP
                                                                          ↳ QDPOrderProof
                                                                            ↳ QDP
                                                                              ↳ QDPOrderProof
                                                                                ↳ QDP
                                                                                  ↳ Narrowing
                                                                                    ↳ QDP
                                                                                      ↳ DependencyGraphProof
                                                                                        ↳ QDP
                                                                                          ↳ Narrowing
                                                                                            ↳ QDP
                                                                                              ↳ DependencyGraphProof
                                                                                                ↳ QDP
                                                                                                  ↳ Narrowing
                                                                                                    ↳ QDP
                                                                                                      ↳ DependencyGraphProof
                                                                                                        ↳ QDP
                                                                                                          ↳ Narrowing
                                                                                                            ↳ QDP
                                                                                                              ↳ DependencyGraphProof
QDP
                                                                                                                  ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(filter(tail(y0), filter(x0, x1))) → A__FILTER(a__tail(mark(y0)), a__filter(mark(x0), mark(x1)))
MARK(filter(s(y0), tail(x0))) → A__FILTER(s(mark(y0)), a__tail(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(filter(head(y0), if(x0, x1, x2))) → A__FILTER(a__head(mark(y0)), a__if(mark(x0), x1, x2))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(filter(head(y0), tail(x0))) → A__FILTER(a__head(mark(y0)), a__tail(mark(x0)))
MARK(filter(tail(y0), head(x0))) → A__FILTER(a__tail(mark(y0)), a__head(mark(x0)))
MARK(filter(if(y0, y1, y2), head(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__head(mark(x0)))
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(filter(head(y0), primes)) → A__FILTER(a__head(mark(y0)), a__primes)
MARK(filter(tail(y0), from(x0))) → A__FILTER(a__tail(mark(y0)), a__from(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(filter(s(y0), cons(x0, x1))) → A__FILTER(s(mark(y0)), cons(mark(x0), x1))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(filter(tail(y0), if(x0, x1, x2))) → A__FILTER(a__tail(mark(y0)), a__if(mark(x0), x1, x2))
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(filter(head(y0), filter(x0, x1))) → A__FILTER(a__head(mark(y0)), a__filter(mark(x0), mark(x1)))
MARK(filter(s(y0), from(x0))) → A__FILTER(s(mark(y0)), a__from(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(if(y0, y1, y2), cons(x0, x1))) → A__FILTER(a__if(mark(y0), y1, y2), cons(mark(x0), x1))
MARK(filter(if(y0, y1, y2), primes)) → A__FILTER(a__if(mark(y0), y1, y2), a__primes)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(filter(tail(y0), primes)) → A__FILTER(a__tail(mark(y0)), a__primes)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(filter(if(y0, y1, y2), from(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__from(mark(x0)))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(filter(tail(y0), cons(x0, x1))) → A__FILTER(a__tail(mark(y0)), cons(mark(x0), x1))
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(filter(if(y0, y1, y2), if(x0, x1, x2))) → A__FILTER(a__if(mark(y0), y1, y2), a__if(mark(x0), x1, x2))
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(filter(s(y0), filter(x0, x1))) → A__FILTER(s(mark(y0)), a__filter(mark(x0), mark(x1)))
MARK(filter(head(y0), cons(x0, x1))) → A__FILTER(a__head(mark(y0)), cons(mark(x0), x1))
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(y0), sieve(x0))) → A__FILTER(a__tail(mark(y0)), a__sieve(mark(x0)))
MARK(filter(if(y0, y1, y2), filter(x0, x1))) → A__FILTER(a__if(mark(y0), y1, y2), a__filter(mark(x0), mark(x1)))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(filter(s(y0), if(x0, x1, x2))) → A__FILTER(s(mark(y0)), a__if(mark(x0), x1, x2))
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(filter(head(y0), sieve(x0))) → A__FILTER(a__head(mark(y0)), a__sieve(mark(x0)))
MARK(filter(if(y0, y1, y2), tail(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__tail(mark(x0)))
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(filter(s(y0), head(x0))) → A__FILTER(s(mark(y0)), a__head(mark(x0)))
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(filter(head(y0), head(x0))) → A__FILTER(a__head(mark(y0)), a__head(mark(x0)))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(filter(s(y0), sieve(x0))) → A__FILTER(s(mark(y0)), a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(filter(head(y0), from(x0))) → A__FILTER(a__head(mark(y0)), a__from(mark(x0)))
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(filter(tail(y0), tail(x0))) → A__FILTER(a__tail(mark(y0)), a__tail(mark(x0)))
MARK(filter(s(y0), primes)) → A__FILTER(s(mark(y0)), a__primes)
MARK(sieve(X)) → MARK(X)
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(filter(if(y0, y1, y2), sieve(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__sieve(mark(x0)))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


MARK(filter(tail(y0), filter(x0, x1))) → A__FILTER(a__tail(mark(y0)), a__filter(mark(x0), mark(x1)))
MARK(filter(head(y0), filter(x0, x1))) → A__FILTER(a__head(mark(y0)), a__filter(mark(x0), mark(x1)))
MARK(filter(s(y0), filter(x0, x1))) → A__FILTER(s(mark(y0)), a__filter(mark(x0), mark(x1)))
MARK(filter(if(y0, y1, y2), filter(x0, x1))) → A__FILTER(a__if(mark(y0), y1, y2), a__filter(mark(x0), mark(x1)))
The remaining pairs can at least be oriented weakly.

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(filter(s(y0), tail(x0))) → A__FILTER(s(mark(y0)), a__tail(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(filter(head(y0), if(x0, x1, x2))) → A__FILTER(a__head(mark(y0)), a__if(mark(x0), x1, x2))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(filter(head(y0), tail(x0))) → A__FILTER(a__head(mark(y0)), a__tail(mark(x0)))
MARK(filter(tail(y0), head(x0))) → A__FILTER(a__tail(mark(y0)), a__head(mark(x0)))
MARK(filter(if(y0, y1, y2), head(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__head(mark(x0)))
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(filter(head(y0), primes)) → A__FILTER(a__head(mark(y0)), a__primes)
MARK(filter(tail(y0), from(x0))) → A__FILTER(a__tail(mark(y0)), a__from(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(filter(s(y0), cons(x0, x1))) → A__FILTER(s(mark(y0)), cons(mark(x0), x1))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(filter(tail(y0), if(x0, x1, x2))) → A__FILTER(a__tail(mark(y0)), a__if(mark(x0), x1, x2))
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(filter(s(y0), from(x0))) → A__FILTER(s(mark(y0)), a__from(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(if(y0, y1, y2), cons(x0, x1))) → A__FILTER(a__if(mark(y0), y1, y2), cons(mark(x0), x1))
MARK(filter(if(y0, y1, y2), primes)) → A__FILTER(a__if(mark(y0), y1, y2), a__primes)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(filter(tail(y0), primes)) → A__FILTER(a__tail(mark(y0)), a__primes)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(filter(if(y0, y1, y2), from(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__from(mark(x0)))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(filter(tail(y0), cons(x0, x1))) → A__FILTER(a__tail(mark(y0)), cons(mark(x0), x1))
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(filter(if(y0, y1, y2), if(x0, x1, x2))) → A__FILTER(a__if(mark(y0), y1, y2), a__if(mark(x0), x1, x2))
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(filter(head(y0), cons(x0, x1))) → A__FILTER(a__head(mark(y0)), cons(mark(x0), x1))
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(y0), sieve(x0))) → A__FILTER(a__tail(mark(y0)), a__sieve(mark(x0)))
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(from(X)) → MARK(X)
MARK(filter(s(y0), if(x0, x1, x2))) → A__FILTER(s(mark(y0)), a__if(mark(x0), x1, x2))
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(divides(X1, X2)) → MARK(X2)
MARK(primes) → A__PRIMES
MARK(filter(head(y0), sieve(x0))) → A__FILTER(a__head(mark(y0)), a__sieve(mark(x0)))
MARK(filter(if(y0, y1, y2), tail(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__tail(mark(x0)))
MARK(filter(X1, X2)) → MARK(X1)
A__IF(true, X, Y) → MARK(X)
MARK(filter(s(y0), head(x0))) → A__FILTER(s(mark(y0)), a__head(mark(x0)))
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(filter(head(y0), head(x0))) → A__FILTER(a__head(mark(y0)), a__head(mark(x0)))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(filter(s(y0), sieve(x0))) → A__FILTER(s(mark(y0)), a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(filter(head(y0), from(x0))) → A__FILTER(a__head(mark(y0)), a__from(mark(x0)))
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(filter(tail(y0), tail(x0))) → A__FILTER(a__tail(mark(y0)), a__tail(mark(x0)))
MARK(filter(s(y0), primes)) → A__FILTER(s(mark(y0)), a__primes)
MARK(sieve(X)) → MARK(X)
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(filter(if(y0, y1, y2), sieve(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__sieve(mark(x0)))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))
Used ordering: Polynomial interpretation [25]:

POL(0) = 0   
POL(A__FILTER(x1, x2)) = x2   
POL(A__FROM(x1)) = 1   
POL(A__HEAD(x1)) = x1   
POL(A__IF(x1, x2, x3)) = 1   
POL(A__PRIMES) = 1   
POL(A__SIEVE(x1)) = 1   
POL(A__TAIL(x1)) = 1   
POL(MARK(x1)) = 1   
POL(a__filter(x1, x2)) = 0   
POL(a__from(x1)) = 1   
POL(a__head(x1)) = 1   
POL(a__if(x1, x2, x3)) = x1   
POL(a__primes) = 1   
POL(a__sieve(x1)) = x1   
POL(a__tail(x1)) = 1   
POL(cons(x1, x2)) = 1   
POL(divides(x1, x2)) = x1   
POL(false) = 1   
POL(filter(x1, x2)) = 0   
POL(from(x1)) = 0   
POL(head(x1)) = 0   
POL(if(x1, x2, x3)) = x1   
POL(mark(x1)) = 1   
POL(primes) = 1   
POL(s(x1)) = 0   
POL(sieve(x1)) = 0   
POL(tail(x1)) = 0   
POL(true) = 1   

The following usable rules [17] were oriented:

a__primesa__sieve(a__from(s(s(0))))
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
a__from(X) → cons(mark(X), from(s(X)))
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(0) → 0
mark(s(X)) → s(mark(X))
mark(from(X)) → a__from(mark(X))
mark(sieve(X)) → a__sieve(mark(X))
a__tail(cons(X, Y)) → mark(Y)
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
a__if(true, X, Y) → mark(X)
mark(tail(X)) → a__tail(mark(X))
mark(head(X)) → a__head(mark(X))
a__head(cons(X, Y)) → mark(X)
a__if(false, X, Y) → mark(Y)
a__sieve(X) → sieve(X)
a__primesprimes
a__head(X) → head(X)
a__from(X) → from(X)
mark(true) → true
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
mark(false) → false
a__filter(X1, X2) → filter(X1, X2)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ Narrowing
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ DependencyGraphProof
                        ↳ QDP
                          ↳ Narrowing
                            ↳ QDP
                              ↳ DependencyGraphProof
                                ↳ QDP
                                  ↳ Narrowing
                                    ↳ QDP
                                      ↳ DependencyGraphProof
                                        ↳ QDP
                                          ↳ Narrowing
                                            ↳ QDP
                                              ↳ DependencyGraphProof
                                                ↳ QDP
                                                  ↳ Narrowing
                                                    ↳ QDP
                                                      ↳ DependencyGraphProof
                                                        ↳ QDP
                                                          ↳ QDPOrderProof
                                                            ↳ QDP
                                                              ↳ QDPOrderProof
                                                                ↳ QDP
                                                                  ↳ QDPOrderProof
                                                                    ↳ QDP
                                                                      ↳ QDPOrderProof
                                                                        ↳ QDP
                                                                          ↳ QDPOrderProof
                                                                            ↳ QDP
                                                                              ↳ QDPOrderProof
                                                                                ↳ QDP
                                                                                  ↳ Narrowing
                                                                                    ↳ QDP
                                                                                      ↳ DependencyGraphProof
                                                                                        ↳ QDP
                                                                                          ↳ Narrowing
                                                                                            ↳ QDP
                                                                                              ↳ DependencyGraphProof
                                                                                                ↳ QDP
                                                                                                  ↳ Narrowing
                                                                                                    ↳ QDP
                                                                                                      ↳ DependencyGraphProof
                                                                                                        ↳ QDP
                                                                                                          ↳ Narrowing
                                                                                                            ↳ QDP
                                                                                                              ↳ DependencyGraphProof
                                                                                                                ↳ QDP
                                                                                                                  ↳ QDPOrderProof
QDP

Q DP problem:
The TRS P consists of the following rules:

MARK(tail(head(x0))) → A__TAIL(a__head(mark(x0)))
MARK(filter(s(y0), tail(x0))) → A__FILTER(s(mark(y0)), a__tail(mark(x0)))
MARK(tail(cons(x0, x1))) → A__TAIL(cons(mark(x0), x1))
MARK(filter(head(y0), if(x0, x1, x2))) → A__FILTER(a__head(mark(y0)), a__if(mark(x0), x1, x2))
MARK(sieve(primes)) → A__SIEVE(a__primes)
MARK(filter(head(y0), tail(x0))) → A__FILTER(a__head(mark(y0)), a__tail(mark(x0)))
MARK(filter(tail(y0), head(x0))) → A__FILTER(a__tail(mark(y0)), a__head(mark(x0)))
MARK(filter(if(y0, y1, y2), head(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__head(mark(x0)))
MARK(head(X)) → MARK(X)
MARK(tail(X)) → MARK(X)
MARK(if(if(x0, x1, x2), y1, y2)) → A__IF(a__if(mark(x0), x1, x2), y1, y2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(sieve(tail(x0))) → A__SIEVE(a__tail(mark(x0)))
MARK(filter(head(y0), primes)) → A__FILTER(a__head(mark(y0)), a__primes)
MARK(filter(tail(y0), from(x0))) → A__FILTER(a__tail(mark(y0)), a__from(mark(x0)))
MARK(tail(from(x0))) → A__TAIL(a__from(mark(x0)))
MARK(filter(s(y0), cons(x0, x1))) → A__FILTER(s(mark(y0)), cons(mark(x0), x1))
MARK(if(X1, X2, X3)) → MARK(X1)
MARK(filter(tail(y0), if(x0, x1, x2))) → A__FILTER(a__tail(mark(y0)), a__if(mark(x0), x1, x2))
MARK(if(true, y1, y2)) → A__IF(true, y1, y2)
MARK(tail(sieve(x0))) → A__TAIL(a__sieve(mark(x0)))
MARK(filter(s(y0), from(x0))) → A__FILTER(s(mark(y0)), a__from(mark(x0)))
MARK(if(false, y1, y2)) → A__IF(false, y1, y2)
MARK(filter(if(y0, y1, y2), cons(x0, x1))) → A__FILTER(a__if(mark(y0), y1, y2), cons(mark(x0), x1))
MARK(filter(if(y0, y1, y2), primes)) → A__FILTER(a__if(mark(y0), y1, y2), a__primes)
MARK(sieve(sieve(x0))) → A__SIEVE(a__sieve(mark(x0)))
A__FROM(X) → MARK(X)
A__PRIMESA__SIEVE(cons(mark(s(s(0))), from(s(s(s(0))))))
A__PRIMESA__FROM(s(s(0)))
A__HEAD(cons(X, Y)) → MARK(X)
A__TAIL(cons(X, Y)) → MARK(Y)
A__IF(false, X, Y) → MARK(Y)
A__SIEVE(cons(X, Y)) → MARK(X)
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(X)
MARK(filter(tail(y0), primes)) → A__FILTER(a__tail(mark(y0)), a__primes)
MARK(head(if(x0, x1, x2))) → A__HEAD(a__if(mark(x0), x1, x2))
MARK(filter(if(y0, y1, y2), from(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__from(mark(x0)))
MARK(if(tail(x0), y1, y2)) → A__IF(a__tail(mark(x0)), y1, y2)
MARK(filter(tail(y0), cons(x0, x1))) → A__FILTER(a__tail(mark(y0)), cons(mark(x0), x1))
MARK(head(tail(x0))) → A__HEAD(a__tail(mark(x0)))
MARK(s(X)) → MARK(X)
MARK(filter(X1, X2)) → MARK(X2)
MARK(sieve(from(x0))) → A__SIEVE(a__from(mark(x0)))
A__FILTER(s(s(X)), cons(Y, Z)) → MARK(Y)
MARK(filter(if(y0, y1, y2), if(x0, x1, x2))) → A__FILTER(a__if(mark(y0), y1, y2), a__if(mark(x0), x1, x2))
MARK(if(head(x0), y1, y2)) → A__IF(a__head(mark(x0)), y1, y2)
MARK(head(primes)) → A__HEAD(a__primes)
MARK(filter(head(y0), cons(x0, x1))) → A__FILTER(a__head(mark(y0)), cons(mark(x0), x1))
MARK(tail(if(x0, x1, x2))) → A__TAIL(a__if(mark(x0), x1, x2))
MARK(filter(tail(y0), sieve(x0))) → A__FILTER(a__tail(mark(y0)), a__sieve(mark(x0)))
MARK(from(X)) → MARK(X)
MARK(sieve(cons(x0, x1))) → A__SIEVE(cons(mark(x0), x1))
MARK(filter(s(y0), if(x0, x1, x2))) → A__FILTER(s(mark(y0)), a__if(mark(x0), x1, x2))
MARK(from(X)) → A__FROM(mark(X))
MARK(head(head(x0))) → A__HEAD(a__head(mark(x0)))
MARK(primes) → A__PRIMES
MARK(divides(X1, X2)) → MARK(X2)
MARK(filter(if(y0, y1, y2), tail(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__tail(mark(x0)))
MARK(filter(head(y0), sieve(x0))) → A__FILTER(a__head(mark(y0)), a__sieve(mark(x0)))
A__IF(true, X, Y) → MARK(X)
MARK(filter(X1, X2)) → MARK(X1)
MARK(filter(s(y0), head(x0))) → A__FILTER(s(mark(y0)), a__head(mark(x0)))
MARK(head(cons(x0, x1))) → A__HEAD(cons(mark(x0), x1))
MARK(sieve(if(x0, x1, x2))) → A__SIEVE(a__if(mark(x0), x1, x2))
MARK(filter(head(y0), head(x0))) → A__FILTER(a__head(mark(y0)), a__head(mark(x0)))
MARK(sieve(head(x0))) → A__SIEVE(a__head(mark(x0)))
MARK(head(sieve(x0))) → A__HEAD(a__sieve(mark(x0)))
MARK(divides(X1, X2)) → MARK(X1)
MARK(filter(s(y0), sieve(x0))) → A__FILTER(s(mark(y0)), a__sieve(mark(x0)))
MARK(filter(head(y0), from(x0))) → A__FILTER(a__head(mark(y0)), a__from(mark(x0)))
MARK(head(from(x0))) → A__HEAD(a__from(mark(x0)))
MARK(filter(s(y0), primes)) → A__FILTER(s(mark(y0)), a__primes)
MARK(filter(tail(y0), tail(x0))) → A__FILTER(a__tail(mark(y0)), a__tail(mark(x0)))
MARK(tail(primes)) → A__TAIL(a__primes)
MARK(sieve(X)) → MARK(X)
MARK(filter(if(y0, y1, y2), sieve(x0))) → A__FILTER(a__if(mark(y0), y1, y2), a__sieve(mark(x0)))
MARK(tail(tail(x0))) → A__TAIL(a__tail(mark(x0)))

The TRS R consists of the following rules:

a__primesa__sieve(a__from(s(s(0))))
a__from(X) → cons(mark(X), from(s(X)))
a__head(cons(X, Y)) → mark(X)
a__tail(cons(X, Y)) → mark(Y)
a__if(true, X, Y) → mark(X)
a__if(false, X, Y) → mark(Y)
a__filter(s(s(X)), cons(Y, Z)) → a__if(divides(s(s(mark(X))), mark(Y)), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y))))
a__sieve(cons(X, Y)) → cons(mark(X), filter(X, sieve(Y)))
mark(primes) → a__primes
mark(sieve(X)) → a__sieve(mark(X))
mark(from(X)) → a__from(mark(X))
mark(head(X)) → a__head(mark(X))
mark(tail(X)) → a__tail(mark(X))
mark(if(X1, X2, X3)) → a__if(mark(X1), X2, X3)
mark(filter(X1, X2)) → a__filter(mark(X1), mark(X2))
mark(s(X)) → s(mark(X))
mark(0) → 0
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(true) → true
mark(false) → false
mark(divides(X1, X2)) → divides(mark(X1), mark(X2))
a__primesprimes
a__sieve(X) → sieve(X)
a__from(X) → from(X)
a__head(X) → head(X)
a__tail(X) → tail(X)
a__if(X1, X2, X3) → if(X1, X2, X3)
a__filter(X1, X2) → filter(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.